<!-- ElementUI 表格 -->
<template>
  <div>
    <el-table :data="students">
      <el-table-column label="编号" prop="id"></el-table-column>
      <el-table-column label="姓名" prop="name"></el-table-column>
      <el-table-column label="性别" prop="sex"></el-table-column>
      <el-table-column label="年龄" prop="age"></el-table-column>
    </el-table>
  </div>
</template>
<script>
import axios from "../util/myaxios";
const options = {
  async mounted() {
    // 获取学生数据
    const resp = await axios.get("api/students");
    this.students = resp.data.data;
  },
  data() {
    return {
      // 存放学生数据数组
      students: [],
    };
  },
};
export default options;
</script>